<template>
	<view class="detail_pages">
		<view style="padding-bottom: 164rpx;">
			<view class="wx_title" :style="titleHeight" v-show="showTitle">
				<uni-icons type="back" size="26" class="wx_back" @click="goBack"></uni-icons>
				商品详情
			</view>
			<view class="go_back" v-show="!showTitle">
				<image :src="IMGLink + '/shopping/back.png'" @click="goBack" class="back_img">
				</image>
			</view>
			<view class="top_box">
				<view class="banner_box">
					<view class="swiper_box">
						<swiper class="swiper" indicator-color='#ffffff' indicator-active-color='#F54642' circular
							indicator-dots autoplay :duration='200' :interval="2000">
							<swiper-item class="swiper-item" v-for="(item,index) in info.carousel_image" :key='index'>
								<image :src="item" mode="widthFix" style="width: 100%;"></image>
							</swiper-item>
						</swiper>
					</view>
					<view class="second_kill" v-show='!info.killed'>
						<image :src="IMGLink + '/shopping/secondkill.png'" mode="" class="second_kill_img"></image>
						<image v-if="info.status == 7 || info.status == 3" :src="IMGLink + '/shopping/hotkill.png'"
							class="second_kill_icon"></image>
						<image v-if="info.status == 1  && info.is_appointment == 0 && subscribe"
							:src="IMGLink + '/shopping/willkill.png'" @click="seckillAppointment"
							class="second_kill_icon"></image>
						<image v-if="info.status == 1 && !subscribe" :src="IMGLink + '/shopping/willstart.png'"
							class="second_kill_icon"></image>
						<image v-if="info.status == 2 || info.status == 9 || info.status == 6"
							:src="IMGLink + '/shopping/nogoods.png'" class="second_kill_icon"></image>
						<image v-if="info.is_appointment == 1" :src="IMGLink + '/shopping/alreadysubscribe.png'"
							class="second_kill_icon"></image>
						<view class="text_box">
							<text class="now_kill_price">¥{{info.selling_price}}</text>
							<text class="before_kill_price">¥{{ info.actual_price }}</text>
							<br />
							<text class="count">
								剩余{{info.stock}}件
							</text>
						</view>
						<view class="count_down">
							<view class="count_desr">
								{{killCon}}
							</view>
							<view class="count_box">
								<text>{{time.hour}}</text>:
								<text>{{time.minute}}</text>:
								<text
									style="background: linear-gradient(90deg, #FC5D5C 0%, #F4362F 100%);">{{time.second}}</text>
							</view>
						</view>
					</view>
					<view class="share_box" v-if='shareShow && !version.embedded'>
						<!-- #ifdef MP-WEIXIN -->
						<button class="share_text" open-type="share">分享好友</button>
						<!-- #endif -->
						<!-- #ifndef MP-WEIXIN -->
						<view class="share_text" @click="showSharepop">分享好友</view>
						<!-- #endif -->
						<view class="share_text" @click="sharePost">
							生成海报
						</view>
					</view>
				</view>
				<view class="commodity_info">
					<view class="price_box" v-if="info.killed">
						<view class="price">
							¥{{info.selling_price}}
						</view>
						<view class="hot_box" style="padding-top: 14rpx;">
							热销：
							<image class="hot_img" v-for="(i,j) in info.hotList" :key='j' :src="i"></image>
						</view>
					</view>
					<text class="tag">
						平台最多补贴{{info.alone_red_packet}}元红包
					</text>
					<view class="detail">
						{{info.name}}
					</view>
				</view>
			</view>
			<view class="freight_box">
				<view class="freight">
					免运费
				</view>
				<view class="methods" @click="toRqure">
					如何获取？
				</view>
			</view>
			<view class="spell_introduce">
				<spellCard @toRules='showRulePop'></spellCard>
			</view>
			<view class="spell_introduce">
				<listCard :info='info' :group_id='group_id' :id="id"></listCard>
			</view>
			<view class="spell_introduce">
				<specifiteCard @showSpecitficatePop='showSpecitficatePop(4)' @showDiscountPop='showDiscount(0)'
					@showServerPop='showServerPop'></specifiteCard>
			</view>
			<view class="spell_introduce">
				<likeCard></likeCard>
			</view>
			<view class="spell_introduce">
				<rich-text :nodes='info.detail'></rich-text>
			</view>
		</view>

		<view class="bottom_card">
			<bottomCard :info='info' :topic_id='topic_id' @singReward='toBuy(1)' @manyReward='toBuy(2)'
				@sceondKilled='toBuy(3)' @refunddePosit='closeReward'></bottomCard>
		</view>
		<!-- 规格 -->
		<uni-popup ref="specitficatepop" type="bottom" class="specifition_pop" :mask-click="true">
			<view class="card_pop">
				<view class="title">
					<view class="title_img">
						<image :src="choseinfo.cover" mode="widthFix" class="title_img"></image>
					</view>
					<view class="price_boxs">
						<view class="price">
							¥{{choseinfo.selling_price}}
						</view>
						<view class="price">
							{{specifitionText}}
						</view>
					</view>
					<uni-icons type="closeempty" style="position: absolute;top: 48rpx;right: 30rpx;" font-size='16px'
						color="#979797" @click="closePop"></uni-icons>
				</view>
				<view class="specification_list">
					<view class="list" v-for="(i,j) in info.goods_specs_list" :key='i.id'>
						<view class="list_name">
							{{i.attr_name}}
						</view>
						<view class="list_child">
							<view class="second_list" v-for='(item,index) in i.attr_values' :key='item.id'
								:class="item.active?'active second_list':'second_list'" @click="choseActive(j,index)">
								{{item.attr_value}}
							</view>
						</view>
					</view>
				</view>
				<view class="money_btn" :style="{background:(is_stock?'#f54642':'#979797')}"
					@click="is_stock && toPay()">
					<text v-if="is_stock">拼购报名</text>
					<text v-else>暂时缺货</text>
					<text class="money">（保证金{{info.pledge_money}}元）</text>
				</view>
			</view>
		</uni-popup>
		<!-- 保证金 -->
		<uni-popup ref="paypop" type="bottom" class="pay_pop" :mask-click="false">
			<view class="card_pop">
				<titlePop :title="payTitle" @close="closePop"></titlePop>
				<view class="tag">
					<view class="tag_left">
						保证金
					</view>
					<view class="tag_right">
						¥{{info.pledge_money}}
					</view>
				</view>
				<view class="text_tip" :style="buyType==2 || buyType==3?'display:none':''">可随时退还保证金</view>
				<view class="text_tip" :style="buyType==1?'display:none':''">未购中立即退还保证金并奖励现金红包</view>
				<view class="pay_list" :style="buyType==1?'display:none':''">
					<view v-for="(i,j) in playList" :key='j' :class="i.active?'pay_btn active':'pay_btn'"
						:style="(buyType==3 && j!==2) || (couponId && j!==2) ?'color:#ccc':''"
						@click="info.killed && choseType(j)">
						<view>
							{{i.name}}
						</view>
						<uni-number-box v-model="i.count" :min="2" :disabled='(couponId && (j!=2)) || info.status==7'
							:style="j==1?'dispaly:block':'display:none'">
						</uni-number-box>
					</view>
				</view>
				<view class="discount_tip" v-if="buyType != 1">
					{{discountText}},
					<text @click="showDiscount(1)">去选择</text>
				</view>

				<view class="btn" @click="toPlay">
					确定
				</view>
				<view class="rule_text">
					<view class="checkbox">
						<uni-data-checkbox v-model="value" :localdata="range" selectedColor='#F54642'
							selectedTextColor='#070707' :multiple="true" @change="change"></uni-data-checkbox>
					</view>
					<view class="text">
						我已知晓
						<text style="color: #84B065;" @click="toRule">《拼购交易规则》</text>
					</view>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="discount" type="top" class="discount_pop" :mask-click="false">
			<discountPop :list='discountList' :coupon="couponFlag" @changecouponId='changecouponId'
				@closeDiscountPop='closeDiscountPop'></discountPop>
		</uni-popup>
		<!-- 抽奖 -->
		<uni-popup ref="singlepop" type="center" :mask-click="false">
			<view class="single_red_bg">
				<image :src="IMGLink + '/shopping/singletitle.png'" mode="" class="single_title">
				</image>
				<view class="red_list">
					<view v-for="(i,j) in redList" :key='j' :class="i.class" @click="enbaleReward && choseLucky(i,j)"
						:style="redbagStyle">
						<image mode="" :src="i.url" class='front' :style="redbagStyle"></image>

						<view class="back">
							<image mode="" :src="i.backUrl" :style="redbagStyle"></image>
							<view class="bag_moeny" v-show="i.money || i.money == 0">
								{{i.money}}元
							</view>
						</view>
					</view>
				</view>
				<view class="specifition">
					{{specifitionText}}
				</view>
				<view class="btn" :style="(!enbaleReward && rewardBtnText)?'':'visibility:hidden;'" @click="rewardBtn">
					{{rewardBtnText}}
				</view>
				<view class="back_moeny" @click.stop="backMoney">
					{{rewardBackText}}
					<!-- 退还保证金 -->
				</view>
			</view>
		</uni-popup>
		<!-- 多人结果 -->
		<uni-popup ref="manypop" type="center" :mask-click="false">
			<view class="many_red_bg" v-if='!manyLast'>
				<image :src="IMGLink + '/shopping/spellsucess.png'" mode="" class="bg_img"></image>
				<view class="rank_text">
					本轮排名第
					<text>{{rank}}</text>
					名
				</view>
				<image :src="IMGLink + '/shopping/spellbtn.png'" mode="" class='many_btn' @click='toSpell'></image>
				<image :src="IMGLink + '/shopping/spellclose.png'" mode="" class="many_close" @click="closeManyPop">
				</image>
			</view>
			<view class="success_red_bg" v-else>
				<image :src="IMGLink + '/shopping/giftsuccess.png'" mode="widthFix" class="gift_success"></image>
				<view class="rank_text">
					拼购成功
				</view>
				<view class="con_text">
					您参与的{{info.name}}已{{sucessMany}}
				</view>
				<view class="jump_btn" @click="toSpell">
					{{sucessManyBtn}}
				</view>
				<image :src="IMGLink + '/shopping/closewhite.png'" mode="" class="many_close" @click="closeManyPop">
				</image>
			</view>
		</uni-popup>
		<!-- 退 -->
		<uni-popup ref="refusepop" type="center" :mask-click="false">
			<view class="refuse_bg">
				<image :src="IMGLink + '/shopping/redbad.png'" mode="" class="bg"></image>
				<view class="btn_box">
					<image :src="IMGLink + '/shopping/refuse.png'" mode="" @click='closeReward'>
					</image>
					<image :src="IMGLink + '/shopping/moreone.png'" mode="" @click="closeRefuse">
					</image>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="serverpop" type="bottom" :mask-click="false">
			<serverPop @closeSeverpopPop='closeSeverpopPop'></serverPop>
		</uni-popup>
		<uni-popup ref="rulepop" type="bottom" :mask-click="false">
			<view class="card_pop">
				<titlePop title="更多规则" @close="closeRulePop"></titlePop>
				<view class="rule_list">
					<view class="rules" @click="singRule">
						<view class="title">
							单人拼购
						</view>
						<view class="content">
							开福袋红包抢不停
						</view>
						<image :src="IMGLink + '/shopping/ruleright.png'" mode=""></image>
					</view>
					<view class="rules" @click="manyRule">
						<view class="title">
							多人拼购
						</view>
						<view class="content">
							多人拼手气分红包
						</view>
						<image :src="IMGLink + '/shopping/ruleright.png'" mode=""></image>
					</view>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="postpop" type="center" :mask-click="false" :animation="false">
			<!-- #ifdef MP-WEIXIN -->
			<postPop ref="post" :info='info' :topic_id='topic_id' @close="closePostPop"></postPop>
			<!-- #endif -->
			<!-- #ifdef H5 -->
			<postPopSc ref="post" :info='info' :topic_id='topic_id' @close="closePostPop"></postPopSc>
			<!-- #endif -->
		</uni-popup>
		<auth ref="auth"></auth>
		<!-- #ifdef H5 -->
		<uni-popup ref="sharepop" type="bottom" :mask-click="true" :animation="false">
			<sharePop :objs='shareObj' @closed='closeShare' @shareTask='shareTask'></sharePop>
		</uni-popup>
		<!-- #endif -->
	</view>
</template>
<script>
	import {
		version
	} from "@/common/config.js"
	import spellCard from './spellcard.vue'
	import listCard from './listcard.vue'
	import specifiteCard from './specification.vue'
	import likeCard from './guesslike.vue'
	import bottomCard from './bottom.vue'
	import titlePop from './titlepop.vue'
	import postPop from './postpop.vue'
	import discountPop from './discount.vue'
	import serverPop from './serverpop.vue'
	import auth from '@/components/auth/auth.vue'
	import postPopSc from './posth5.vue'
	//#ifdef H5 
	import sharePop from '@/components/share/index.vue'
	//#endif
	import {
		formatRichText,
		navigateTo,
		storage,
		getKey
	} from '../../common/js/util.js'
	import {
		is_wx
	} from '@/utils/weixin.js'
	import {
		getdetail,
		getUserCouponsList,
		personalRefundPledgeMoney,
		shareTask,
		goodsSpecsInfo
	} from '@/api/shopping/shopping.js'
	import secondkill from './js/secondkill.js'
	import playjs from './js/play.js'
	import sharejs from '@/components/share/index.js'
	import {
		mapState
	} from 'vuex'
	export default {
		mixins: [secondkill, playjs, sharejs],
		computed: {
			...mapState(['hasRegister', 'userinfo'])
		},
		data() {
			return {
				version: version,
				invitation_code: null,
				IMGLink: this.IMGLink,
				payTitle: '支付保证金',
				killCon: '距离开始还有',
				isPrevent: true,
				showTitle: false,
				titleHeight: '',
				discountList: [],
				rank: 0,
				rewardBtnText: '',
				rewardBackText: '退还保证金>',
				backList: [],
				value: [],
				range: [{
					"value": 0,
					"text": ""
				}],
				likeList: [],
				playList: [{
					name: '今日拍中即止',
					active: true,
					id: 3
				}, {
					name: '自定义拼购次数',
					count: 2,
					active: false,
					id: 2
				}, {
					name: '单次拼购',
					active: false,
					id: 1
				}],
				buyType: 0,
				specifitionText: '',
				specifitionIds: [],
				enbaleReward: true,
				scrollTop: 0,
				id: null,
				info: {
					hotList: [],
					name: '',
					carousel_image: [],
					actual_price: '',
					selling_price: '',
					total_red_packet: '',
					pledge_money: '',
					people_number: '',
					specs_type: '',
					hot_sale: 0,
					detail: '',
					stock: null,
					goods_specs_list: [],
					status: null,
					time_from: '',
					time_to: '',
					killed: true,
					user_type: null,
					alone_red_packet: '',
					is_appointment: 0
				},
				playId: 3,
				couponId: null,
				couponFlag: false,
				redbagStyle: '',
				manyLast: false,
				sucessMany: '成功',
				sucessManyBtn: '去查看',
				serialNum: null,
				group_type: null,
				authShow: true,
				group_id: null,
				topic_id: null,
				shareShow: false,
				discountText: '选择使用优惠券',
				choseinfo: {
					cover: '',
					selling_price: ''
				},
				is_stock: true,
				subscribe: true,
				payFlag: true,
				shareObj: {
					title: '',
					link: '',
					desc: '',
					imgUrl: ''
				}
			}
		},
		components: {
			spellCard,
			listCard,
			specifiteCard,
			likeCard,
			bottomCard,
			titlePop,
			postPop,
			discountPop,
			serverPop,
			postPopSc,
			//#ifdef H5
			sharePop
			//#endif
		},
		onShow() {
			this.getdetail();
			this.shareShow = this.hasRegister;
		},
		onBackPress(e) {
			clearInterval(this.interval)
		},
		onHide() {
			clearInterval(this.interval)
		},
		onLoad(e) {
			this.id = decodeURIComponent(e.id);
			this.group_type = e.group_type ?? null;
			this.group_id = e.group_id ?? null;
			this.topic_id = e.topic_id ?? null; //专区id
			// #ifdef H5
			if (!location.href?.includes('&')) {
				const str = 'index?'
				this.id = getKey('id', str);
				this.group_type = getKey('group_type', str) ?? null;
				this.group_id = getKey('group_id', str) ?? null;
				this.topic_id = getKey('topic_id', str) ?? null; //专区id
			}
			// #endif

			let code = e.scene ?? '';
			this.invitation_code = decodeURIComponent(code); // 返回判断
			storage.getStorage('checked', (res) => {
				if (res.data) {
					this.value.push(0);
				}
			})
			//#ifdef MP-WEIXIN	
			let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
			this.titleHeight =
				`padding-top:${menuButtonInfo.top}px;height:${menuButtonInfo.height}px;line-height:${menuButtonInfo.height}px;`;
			if (code) {
				this.$store.commit("setShareInvitationCode", decodeURIComponent(code))
			}
			//#endif
			//#ifdef H5
			this.titleHeight = `padding-top:30rpx;height:50rpx;line-height:50rpx;`;
			//#endif
			this.getdetail(1);
		},
		methods: {
			onPageScroll({
				scrollTop
			}) {
				if (scrollTop > 100) {
					this.showTitle = true;
				} else if (scrollTop < 10) {
					this.showTitle = false;
				}
			},
			checkLogin() {
				this.$refs.auth.checkLogin();
			},
			onShareAppMessage(options) {
				var shareObj = {
					title: this.info.name,
					path: this.sharePath(),
					imageUrl: '',
					success: (res) => {
						if (res.errMsg == 'shareAppMessage:ok') {
							console.log('成功');
						}
					},
				};
				if (options.from == 'button') {
					var eData = options.target.dataset;
					shareObj.path = this.sharePath();
				}
				this.shareTask();
				return shareObj;
			},
			sharePath() {
				let icstr = encodeURIComponent(this.userinfo.invitation_code)
				let path = `/pages/shopping/commodity/detail/index?id=${this.id}&scene=${icstr}`
				if (this.topic_id) {
					path = `${path}&topic_id=${this.topic_id}`
				}
				return path;
			},
			shareParam() {
				this.shareObj = {
					title: '拼团购',
					link: `${location.origin}${this.sharePath()}`,
					desc: this.info.name,
					imgUrl: this.info.carousel_image[0]
				};
			},
			showSharepop() {
				this.shareParam();
				if (is_wx()) {
					this.$refs.sharepop.open('top');
				} else {
					this.$refs.sharepop.open('bottom');
				}
			},
			async shareTask() {
				const res = await shareTask()
			},
			async getdetail(a) {
				const res = await getdetail({
					id: this.id,
					group_type: this.group_type,
					group_id: this.group_id
				})
				if (res) {
					this.info = Object.assign(this.info, res.data);
					this.info.detail = formatRichText(res.data.detail);
					for (let i = 0; i < res.data.hot_sale; i++) {
						this.info.hotList.push(`${this.IMGLink}/shopping/redhot.png`);
					}
					this.info.hotList.length = 3;
					this.info.hotList.fill(`${this.IMGLink}/shopping/greyhot.png`, this.info
						.hot_sale, 3);
					for (let i of this.info.goods_specs_list) {
						if (i?.attr_values) {
							for (let j of i.attr_values) {
								j.active = false;
							}
							i.attr_values[0].active = true;
						}
					}
					this.specifitionText = '';
					this.specifitionIds = [];
					this.specifitionIds.length = 0;
					this.info.goods_specs_list?.map((i, j) => {
						let item = {
							id: i.id,
							list: {
								id: i.attr_values[0]?.id,
								attr_value: i.attr_values[0]?.attr_value
							}
						}
						this.specifitionIds.push(item);
						this.specifitionText += i.attr_values[0]?.attr_value;
					})
					if (this.info.status == 1) {
						this.countDown(this.info.time_from);
						if (this.differ > 0) {
							this.timer(this.info.time_from)
						}
					} else if (this.info.status == 2 || this.info.status == 7 || this.info.status == 3) {
						if (this.info.time_to) {
							this.countDown(this.info.time_to);
							if (this.differ > 0) {
								this.timer(this.info.time_to)
							}
						}
					}
					this.people_number = 10
					if (this.info.time_from == '' || this.info.time_to == '') {
						this.info.killed = true;
					} else {
						this.info.killed = false;
						this.playList.map(i => {
							i.active = false
						})
						this.playList[2].active = true;
					}
					if (a == 1) {
						this.redList.length = 0;
						this.redList = [];
						for (let i = 0; i < this.info.people_number; i++) {
							let item = {
								url: `${this.IMGLink}/shopping/luckybag.png`,
								backUrl: `${this.IMGLink}/shopping/shadowbag.png`,
								class: 'red_box'
							}
							this.redList.push(item)
						}
						this.enbaleReward = true;
						this.rewardBackText = '退还保证金>';
					}
					// #ifdef H5
					if (is_wx()) {
						this.shareParam();
						this.groupInvite();
					}
					// #endif

				}
				// #ifdef H5
				if (this.payFlag) {
					const str = 'index?'
					this.zf_num = getKey('zf_num', str) ?? null;
					if (getKey('type', str) == 2) {
						this.pay_pledge_money_type = 2;
						this.personalBuy();
					} else if (getKey('type', str) == 1) {
						this.pay_pledge_money_type = 2;
						this.groupBuy();
					}
				}
				// #endif
			},
			timer(now) {
				this.interval = setInterval(() => {
					if (this.differ <= 1) {
						clearInterval(this.interval);
						this.getdetail();
					} else {
						this.countDown(now);
					}
				}, 1000)
			},
			changecouponId(data) {
				this.couponId = data
			},
			async getUserCouponsList() {
				const res = await getUserCouponsList({
					type: 2,
					status: 1,
					topic_id: this.topic_id
				})
				if (res) {
					if (res.data.list.length !== 0) {
						if (this.topic_id == 2) {
							this.playList.map(i => {
								i.active = false
							})
							this.playList[2].active = true;
						}
						res.data.list.map((i) => {
							i.active = false;
						})
						res.data.list[0].active = true;
						this.couponId = res.data.list[0].id;
						this.discountList = res.data.list;
						this.discountText = '已选免保证金券';
					}
					this.$refs.discount.open('bottom');
				}
			},

			singRule() {
				navigateTo('/pages/shopping/commodity/rule/index')
			},
			manyRule() {
				navigateTo('/pages/shopping/commodity/rule/rule?type=9');
			},
			goBack() {
				if (this.invitation_code) {
					uni.switchTab({
						url: "/pages/index/home/index"
					})
				} else {
					this.goHistory();
				}
				this.interval ? clearInterval(this.interval) : '';
			},
			goHistory() {
				let canNavBack = getCurrentPages();
				if (canNavBack && canNavBack.length > 1) {
					uni.navigateBack({
						delta: 1
					});
				} else if (getKey('inex', 'index?') == 2) {
					uni.switchTab({
						url: "pages/shopping/shopping"
					})
				} else if (getKey('index', 'index?')) {
					history.go(-1);
				} else {
					uni.switchTab({
						url: "/pages/index/home/index"
					})
				}
			},
			sharePost() {
				this.showPostPop();
				setTimeout(() => {
					this.$refs.post.canvasShow = true;
				}, 0)
				setTimeout(() => {
					this.$refs.post.requireInfo(this.info);
				}, 300)
			},
			toRqure() {
				navigateTo('/pages/shopping/commodity/rule/rule?type=5')
			},
			toRule() {
				navigateTo('/pages/shopping/commodity/rule/rule?type=14');
			},
			toBuy(data) {
				this.buyType = data;
				if (this.buyType == 1 && (this.info.status == 8 || this.info.status == 5)) {
					this.$refs.singlepop.open('center')
					this.goodsSpecsInfo();
				} else {
					this.showSpecitficatePop();
				}
			},
			showSpecitficatePop(data) {
				if (data == 4 && this.info.group_method == 2 && !this.info.killed) {
					data = 3
				} else if (data == 4 && this.info.group_method == 2) {
					data = 2;
				} else if (data == 4) {
					data = 1
				}
				this.buyType = data || this.buyType;
				this.goodsSpecsInfo();
				this.$refs.specitficatepop.open('bottom')
			},
			closePop() {
				this.$refs.specitficatepop.close();
				this.$refs.paypop.close()
			},
			toPay() {
				if (!this.hasRegister) {
					this.checkLogin();
				} else {
					this.$refs.specitficatepop.close();
					this.$refs.paypop.open('bottom')
					this.showPayPop()
				}
			},
			showPayPop() {
				this.buyType == 1 ? this.payTitle = '支付保证金' : this.payTitle = '更多玩法';
				this.$refs.paypop.open('bottom')
			},
			showDiscount(data) {
				if (!this.hasRegister) {
					this.checkLogin();
				} else {
					this.getUserCouponsList();
					data == 1 ? this.couponFlag = true : this.couponFlag = false;
				}
			},
			showServerPop() {
				this.$refs.serverpop.open('bottom')
			},
			showRulePop() {
				if (this.info.time_from != '' && this.info.time_to != '') {
					this.manyRule();
				} else {
					this.$refs.rulepop.open('bottom')
				}
			},
			showPostPop() {
				this.$refs.postpop.open('center');
			},
			closeShare() {
				this.$refs.sharepop.close()
			},
			closeDiscountPop() {
				this.$refs.discount.close()
			},
			closeSeverpopPop() {
				this.$refs.serverpop.close()
			},
			closeManyPop() {
				this.$refs.manypop.close()
			},
			async closeReward(data) {
				uni.showToast({
					title: '',
					icon: "loading",
					duration: 500,
					mask: true
				})
				const res = await personalRefundPledgeMoney({
					goods_id: this.info.id
				});
				if (res.code == 200) {
					if (data !== 1) {
						this.closeSingle();
						this.$refs.refusepop.close();
						this.getdetail();
					}
					this.userinfo.user_account = Number(this.info.pledge_money) + Number(this.userinfo.user_account);
					this.$store.commit("setUserInfo", this.userinfo);
				}
			},
			closeSingle() {
				this.$refs.singlepop.close();
			},
			closeRefuse() {
				this.$refs.refusepop.close();
				this.rewardBtnText = '再来一次';
				this.rewardBtn()
			},
			closeRulePop() {
				this.$refs.rulepop.close();
			},
			closePostPop() {
				uni.hideLoading();
				this.$refs.postpop.close();
			},
			toSpell() {
				this.closeManyPop();
				if (this.sucessManyBtn == '去支付') {
					navigateTo(`/pagesA/my/orders/orderDetail?serial_num=${this.serialNum}`)
				} else {
					navigateTo('/pagesA/my/groupbuylist/grouplist')
				}
			},
			change(e) {
				if (e.detail.value.length) {
					storage.setStorage('checked', true)
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import '../../common/css/color.scss';
	@import './css/detail.scss';
	@import './css/specifitionpop.scss';
	@import './css/paypop.scss';
	@import './css/single.scss';
	@import './css/serverpop.scss';

	image {
		max-width: 100%;
	}

	img {
		max-width: 100%;
	}

	/deep/ .uni-popup .uni-popup__wrapper {
		padding-bottom: 0 !important;
	}
</style>
